//
//  MyTravelTableViewCell.m
//  ToWhere
//
//  Created by dllo on 15/11/24.
//  Copyright © 2015年 www.TE.com. All rights reserved.
//

#import "MyTravelTableViewCell.h"
#import <SDWebImageManager.h>
#import <UIImageView+WebCache.h>
@implementation MyTravelTableViewCell

- (void)dealloc
{
    [_yj release];
    [_imageV release];
    [_label release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imageV = [[UIImageView alloc] init];
        [self.contentView addSubview:_imageV];
        [_imageV release];
        
        self.label = [[UILabel alloc] init];
        self.label.numberOfLines = 0;
        self.label.textColor = [[UIColor blackColor]colorWithAlphaComponent:0.7];
        self.label.font = [UIFont systemFontOfSize:17 *kWidth];
        [self.contentView addSubview:_label];
        [_label release];
    }
    return self;
}
- (void)layoutSubviews{
    [super layoutSubviews];
    
    self.imageV.frame = CGRectMake(3, 3, 369 *kWidth, 144 *kHeight);
    
    self.label.frame = CGRectMake(10 *kWidth, 147 *kHeight , 355 *kWidth, 30 *kHeight);
    
}
- (void)setYj:(YJCollection *)yj{

    if (_yj != yj) {
        [_yj release];
        _yj = [yj retain];
    }
    [self.imageV sd_setImageWithURL:[NSURL URLWithString:[yj yjURL]] placeholderImage:[UIImage imageNamed:@"placeHoder"]];
    self.label.text = [yj yjName];

}
+ (MyTravelTableViewCell *)MyTravelTableViewCellWithTableView:(UITableView *)tableView{
    
    static NSString *myPoticTableVIewCell = @"MyPoticTableVIewCell";
    MyTravelTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:myPoticTableVIewCell];
    if (!cell) {
        cell = [[MyTravelTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:myPoticTableVIewCell];
    }
    return cell;
}
@end


